String.prototype.trunc = function(n){
	return this.substr(0,n-1)+(this.length>n?'...':'');
};
String.prototype.ltrim = function(chars){
	chars = chars || "\\s";
	return this.replace(new RegExp("^[" + chars + "]+", "g"), "");
};

String.prototype.rtrim = function(chars){
	chars = chars || "\\s";
	return this.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

String.prototype.trim = function(chars){
	return this.ltrim(chars).rtrim(chars);
};
